package com.example.a10928.weifriend.http.poll;

import io.reactivex.disposables.Disposable;
import io.reactivex.subjects.BehaviorSubject;

/**
 * Created by Chuang on 2018/4/4.
 * 请声明此类的作用，如无声明则留null
 */
public class SubjectModel<T> {

    //Subject
    private BehaviorSubject<T> behaviorSubject;
    //订阅关系
    private Disposable disposable;
    //轮询器
    private PollingRequest pollingRequest;

    public SubjectModel( Disposable disposable, PollingRequest pollingRequest, BehaviorSubject<T> behaviorSubject) {
        this.behaviorSubject = behaviorSubject;
        this.disposable = disposable;
        this.pollingRequest = pollingRequest;
    }

    public BehaviorSubject<T> getBehaviorSubject() {
        return behaviorSubject;
    }

    public Disposable getDisposable(){
        return disposable;
    }

    public void clearSubject() {
        if (null == disposable || disposable.isDisposed()) return;

        disposable.dispose();
    }

}
